<?php

class manplanController {
	
	function __construct() {
	}
	
	public function render( $tplname, $data = null ) {
		$block = App::me()->viewPath. DIRECTORY_SEPARATOR . 'manplan' . DIRECTORY_SEPARATOR . $tplname;
		$tpl = App::me()->tpl;
		if( $data ) {
			if( $data->errcode ) {
				$block = App::me()->viewPath. DIRECTORY_SEPARATOR . 'layout' . DIRECTORY_SEPARATOR . 'error';
				$tpl->assign('data', $data->errmess);
			}
			else $tpl->assign('data', $data);
		}
			
		$tpl->display($block.'.tpl');
	}
	
	public function index() {		
		if( !Tools::isAjax() ) return;
		$this->render('manplan-form');		
	}	

	public function listart() {		
		if( !Tools::isAjax() ) return;
		session_start();
		$model = new manplan;
		$data = $model->listart();
		echo json_encode( $data );
	}
	
	public function report() {		
		session_start();
		$model = new manplan;
		$data = $model->report();
		$this->render('report',$data);		
	}
	
	public function jsload() {		
		if( !Tools::isAjax() ) return;
		App::me()->js_load('manplan.js');
	}	
	
}
?>